/*
 * @Author: wanlixin
 * @Date: 2019-10-05 10:41:31
 * @LastEditors: sylvanas
 * @LastEditTime: 2019-10-29 21:18:55
 * @Description: 校验使用的组件在没有定义name字段时做出提示, 例如： name: "grimm-button"
 */
import { tip } from '../../common/helpers/debug';

export default {
  methods: {
    _checkDeprecated() {
      const { name: componentName, props } = this.$options;

      Object.entries(props).forEach(([key, { deprecated }]) => {
        if (deprecated && this[key] !== undefined) {
          tip('warn', componentName);
        }
      });
    },
  },
  mounted() {
    this._checkDeprecated();
  },
};
